﻿namespace Sidvall.AuthorizationManager.Data.Keys
{
    public class AuthorizationScopeUserKey
    {
        public long AuthorizationScopeId { get; set; }
        public string UserId { get; set; }
        
        public static AuthorizationScopeUserKey GetKey(IAuthorizationScopeUser item)
        {
            if (item == null)
                return null;
            if (item.UserId == null)
                return null;
            return new AuthorizationScopeUserKey()
            {
                AuthorizationScopeId = item.AuthorizationScopeId,
                UserId = item.UserId,
            };
        }
        public static AuthorizationScopeUserKey GetKey(long authorizationScopeId, string userId)
        {
            if (userId == null)
                return null;
            return new AuthorizationScopeUserKey()
            {
                AuthorizationScopeId = authorizationScopeId,
                UserId = userId,
            };
        }
    }
}